/**
  ******************************************************************************
  * @file    RELAY_CFG.h
  * @author  Feirui_Joe
  * @version V0.1
  * @date    07/26/2010
  * @brief   Outputs Driver
  ******************************************************************************
  * @copy
  *
  * <h2><center>&copy; COPYRIGHT 2010 Feirui</center></h2>
  */ 



/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef  __RELAY_CFG_H__
#define  __RELAY_CFG_H__


#ifdef __cplusplus
 extern "C" {
#endif


/**
  * @brief  INCLUDE FILES.
  */


/**
  * @brief GLOBALS RAM definition
  */
#ifdef   RELAY_CFG_GLOBALS
#define  RELAY_CFG_EXT
#else
#define  RELAY_CFG_EXT  extern
#endif



/** LXC720G
  * @brief   Outputs                   Port
  * @param3  RelayAux1------------------PE9  (O)
  * @param4  RelayAux2------------------PE12 (O)
  * @param5  RelayAux3------------------PE13 (O)
  * @param6  RelayAux4------------------PE14 (O)
  * @param7  RelayAux5------------------PE15 (O)
  * @param8  RelayAux6------------------PC7  (O)
  * @param1  RelayFUEL------------------PE7  (O)
  * @param2  RelayCRANK-----------------PE8  (O)
  * @param8  RelayDplus-----------------PB2  (O)
  */
#define RCCPeriph_RelayOut_Aux1           RCC_APB2Periph_GPIOE
#define GPIOModeO_RelayOut_Aux1           GPIO_Mode_Out_PP
#define GPIOSpeed_RelayOut_Aux1           GPIO_Speed_2MHz
#define GPIOxPort_RelayOut_Aux1           GPIOE
#define GPIOxBitx_RelayOut_Aux1           GPIO_Pin_9

#define RCCPeriph_RelayOut_Aux2           RCC_APB2Periph_GPIOE
#define GPIOModeO_RelayOut_Aux2           GPIO_Mode_Out_PP
#define GPIOSpeed_RelayOut_Aux2           GPIO_Speed_2MHz
#define GPIOxPort_RelayOut_Aux2           GPIOE
#define GPIOxBitx_RelayOut_Aux2           GPIO_Pin_12

#define RCCPeriph_RelayOut_Aux3           RCC_APB2Periph_GPIOE
#define GPIOModeO_RelayOut_Aux3           GPIO_Mode_Out_PP
#define GPIOSpeed_RelayOut_Aux3           GPIO_Speed_2MHz
#define GPIOxPort_RelayOut_Aux3           GPIOE
#define GPIOxBitx_RelayOut_Aux3           GPIO_Pin_13

#define RCCPeriph_RelayOut_Aux4           RCC_APB2Periph_GPIOE
#define GPIOModeO_RelayOut_Aux4           GPIO_Mode_Out_PP
#define GPIOSpeed_RelayOut_Aux4           GPIO_Speed_2MHz
#define GPIOxPort_RelayOut_Aux4           GPIOE
#define GPIOxBitx_RelayOut_Aux4           GPIO_Pin_14

#define RCCPeriph_RelayOut_Aux5           RCC_APB2Periph_GPIOE
#define GPIOModeO_RelayOut_Aux5           GPIO_Mode_Out_PP
#define GPIOSpeed_RelayOut_Aux5           GPIO_Speed_2MHz
#define GPIOxPort_RelayOut_Aux5           GPIOE
#define GPIOxBitx_RelayOut_Aux5           GPIO_Pin_15

#define RCCPeriph_RelayOut_Aux6           RCC_APB2Periph_GPIOC
#define GPIOModeO_RelayOut_Aux6           GPIO_Mode_Out_PP
#define GPIOSpeed_RelayOut_Aux6           GPIO_Speed_2MHz
#define GPIOxPort_RelayOut_Aux6           GPIOC
#define GPIOxBitx_RelayOut_Aux6           GPIO_Pin_7

#define RCCPeriph_RelayOut_FUEL           RCC_APB2Periph_GPIOE
#define GPIOModeO_RelayOut_FUEL           GPIO_Mode_Out_PP
#define GPIOSpeed_RelayOut_FUEL           GPIO_Speed_2MHz
#define GPIOxPort_RelayOut_FUEL           GPIOE
#define GPIOxBitx_RelayOut_FUEL           GPIO_Pin_7

#define RCCPeriph_RelayOut_CRANK          RCC_APB2Periph_GPIOE
#define GPIOModeO_RelayOut_CRANK          GPIO_Mode_Out_PP
#define GPIOSpeed_RelayOut_CRANK          GPIO_Speed_2MHz
#define GPIOxPort_RelayOut_CRANK          GPIOE
#define GPIOxBitx_RelayOut_CRANK          GPIO_Pin_8

#define RCCPeriph_RelayOut_Dplus          RCC_APB2Periph_GPIOB
#define GPIOModeO_RelayOut_Dplus          GPIO_Mode_Out_PP
#define GPIOSpeed_RelayOut_Dplus          GPIO_Speed_2MHz
#define GPIOxPort_RelayOut_Dplus          GPIOB
#define GPIOxBitx_RelayOut_Dplus          GPIO_Pin_2

typedef struct
{
  uint32_t              RCC_APB2Periph;
  GPIOMode_TypeDef      GPIO_Mode;
  GPIOSpeed_TypeDef     GPIO_Speed;
  GPIO_TypeDef*         GPIOx;
  uint16_t              GPIO_Pin;
} RelayCfg_TypeDef;

#define RelayOutBit_Aux1                  DEF_BIT_00
#define RelayOutBit_Aux2                  DEF_BIT_01
#define RelayOutBit_Aux3                  DEF_BIT_02
#define RelayOutBit_Aux4                  DEF_BIT_03
#define RelayOutBit_Aux5                  DEF_BIT_04
#define RelayOutBit_Aux6                  DEF_BIT_05
#define RelayOutBit_FUEL                  DEF_BIT_06
#define RelayOutBit_CRANK                 DEF_BIT_07
#define RelayOutBit_Dplus                 DEF_BIT_08

#define RelayOutOrd_Aux1                  0
#define RelayOutOrd_Aux2                  1
#define RelayOutOrd_Aux3                  2
#define RelayOutOrd_Aux4                  3
#define RelayOutOrd_Aux5                  4
#define RelayOutOrd_Aux6                  5
#define RelayOutOrd_FUEL                  6
#define RelayOutOrd_CRANK                 7
#define RelayOutOrd_Dplus                 8
#define RelayOutputsTOTNum                (RelayOutOrd_Dplus+1)
RELAY_CFG_EXT const RelayCfg_TypeDef RelayOutCfgTable[RelayOutputsTOTNum];




/* Pcfg Buffer RelayOut Config Order */                                   
#define RelayOutPcfgBFOrd_Aux1Active                               (Adr_RelayOutput1Active-Adr_RelayOutput1Active)
#define RelayOutPcfgBFOrd_Aux1Type                                 (Adr_RelayOutput1Type  -Adr_RelayOutput1Active)
#define RelayOutPcfgBFOrd_Aux2Active                               (Adr_RelayOutput2Active-Adr_RelayOutput1Active)
#define RelayOutPcfgBFOrd_Aux2Type                                 (Adr_RelayOutput2Type  -Adr_RelayOutput1Active)
#define RelayOutPcfgBFOrd_Aux3Active                               (Adr_RelayOutput3Active-Adr_RelayOutput1Active)
#define RelayOutPcfgBFOrd_Aux3Type                                 (Adr_RelayOutput3Type  -Adr_RelayOutput1Active)
#define RelayOutPcfgBFOrd_Aux4Active                               (Adr_RelayOutput4Active-Adr_RelayOutput1Active)
#define RelayOutPcfgBFOrd_Aux4Type                                 (Adr_RelayOutput4Type  -Adr_RelayOutput1Active)
#define RelayOutPcfgBFOrd_Aux5Active                               (Adr_RelayOutput5Active-Adr_RelayOutput1Active)
#define RelayOutPcfgBFOrd_Aux5Type                                 (Adr_RelayOutput5Type  -Adr_RelayOutput1Active)
#define RelayOutPcfgBFOrd_Aux6Active                               (Adr_RelayOutput6Active-Adr_RelayOutput1Active)
#define RelayOutPcfgBFOrd_Aux6Type                                 (Adr_RelayOutput6Type  -Adr_RelayOutput1Active)
#define RelayOutPcfgBFTOT_CfgNum                                   (RelayOutPcfgBFOrd_Aux6Type+1)









#ifdef __cplusplus
}
#endif


#endif   /*  __RELAY_CFG_H__  */

/******************* (C) COPYRIGHT 2010 Feirui *****END OF FILE****/